// Learn TypeScript:
//  - https://docs.cocos.com/creator/manual/en/scripting/typescript.html
// Learn Attribute:
//  - https://docs.cocos.com/creator/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
//  - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html

const { ccclass, property } = cc._decorator;

@ccclass
export default class NewClass extends cc.Component {

    @property(cc.Label)
    label: cc.Label = null;

    @property
    text: string = 'hello';

    // LIFE-CYCLE CALLBACKS:

    // onLoad () {}

    start() {
        this.node.on(cc.Node.EventType.TOUCH_START, () => {
            let mat4 = cc.mat4();
            this.node.children[0].children[0].getWorldMatrix(mat4);
            //this.node.children[0].position = this.node.children[0].position.add(cc.v3(1, 1))
            //this.node.position = this.node.position.add(cc.v3(10, 10));
            let nw = new cc.Node();
            nw.height = 200;
            this.node.parent.addChild(nw)
            //this.node.scale += 0.1;
            requestAnimationFrame(() => {
                let afterMat4 = cc.mat4();
                this.node.children[0].children[0].getWorldMatrix(afterMat4);
                console.warn(afterMat4.equals(mat4));

            })
        })
    }

    // update (dt) {}
}
